<?php
@session_start();
$PurviewLevel=2;
$CheckChannelID=0;  
$PurviewLevel_Others="yingxiao_vpp_danye";

require("../../inc/common.inc.php");
require_once("../Admin_ChkPurview.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="../images/style.css" type="text/css">
</head>
<body> 
<?php
if($actions=="saveadd"){
    $pid=intval($pid);
	if ($name==""){
		$fun->popmassage("单页名称不能为空","","popback");
		exit();
	}
	if ($orderid==""){$orderid=666;}
	$content=str_replace($truepath,"",$content);

	$fields=array(
		"pid"          =>$pid,
		"name"         =>$name,
		"keywords"     =>$keywords,
		"description"  =>$description,
		"picurl"       =>$picurl,
		"content"      =>$content,
		"orderid"      =>$orderid,
		"adddate"      =>date("Y-m-d H:i:s"),
		"addid"        =>$_SESSION['mxadmin']['userid'],
	);
	$result=$db->exe_insert("mx_vpp_infor",$fields);	
	if($result){
	  jump2("成功添加","yx_vpp_danye.php",1);
	  exit();
	}else{
	  jump2("添加失败","yx_vpp_danye.php",1);
	  exit();
	}
}
elseif($actions=="saveedit"){
    $pid=intval($pid);
	if ($name==""){
		$fun->popmassage("单页名称不能为空","","popback");
		exit();
	}
	if ($orderid==""){$orderid=666;}
	$fields=array(
		"pid"          =>$pid,
		"name"         =>$name,
		"keywords"     =>$keywords,
		"description"  =>$description,
		"picurl"       =>$picurl,
		"content"      =>$content,
		"orderid"      =>$orderid,
		"modidate"      =>date("Y-m-d H:i:s"),
		"modiid"        =>$_SESSION['mxadmin']['userid'],
	);
	$result=$db->exe_update("mx_vpp_infor",$fields,"id='$id'");	
	if($result){
	    if($spic!=$oldpicurl){
		    @unlink("../$webdb[updir]/$oldpicurl");
		}
	  if (trim($gotourl)==""){
	  $gotourl=$FROMURL;
	  }else{$gotourl=url_code($gotourl);}
	  jump2("成功更新","$gotourl",1);
	  exit();
	}else{
	  if (trim($gotourl)==""){
	  $gotourl=$FROMURL;
	  }else{$gotourl=url_code($gotourl);}

	  jump2("更新失败","$gotourl",1);
	  exit();
	}

}
elseif($actions=="del"){
	$sql="delete from mx_vpp_infor where id='$id'";
	$result=$db->excu($sql);
	if($result){
	  $db->excu("delete from mx_vpp_infor where pid='$id'");
	  $url=$fromurl?$fromurl:$FROMURL;
	  jump2("成功删除",$url,1);
	  exit();
	}else{
	  $url=$fromurl?$fromurl:$FROMURL;
	  jump2("删除失败",$url,1);
	  exit();
	}
}

require("../mx_head.php");?>
<div class="right">
<?PHP
if($actions=="add"){
?>
<div class="xm2">
<h1 class="fl">添加单页信息</h1>
</div>
<div class="xm2_b">
<div class="height10"></div>
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="table_southidc">
<form id="form1" name="form1" method="post" action="yx_vpp_danye.php?actions=saveadd"  onSubmit="return check();">
    <!--<tr class="list">
      <td width="14%" height="20" align="center">所属类别：</td>
      <td width="86%"><label>
        <select name="pid">
		<option value="0">顶级栏目</option>
		<?php
		$rs=$db->excu("select * from mx_vpp_infor where pid='0'");
		if (mysql_num_rows($rs)>0 ){
		    while($rsdb=mysql_fetch_array($rs)){
		?>
		<option value="<?php echo $rsdb["id"]?>" <?php if ($rsdb["id"]==$id){echo "selected";}?>><?php echo $rsdb["name"]?></option>
		<?php
			}
		}
		?>
		</select>
      </label></td>
    </tr>-->
    <tr class="list">
      <td width="14%" height="20" align="center">单页名称：</td>
      <td width="86%"><input name="name" type="text" id="name" size="60"/></td>
    </tr>
    <tr class="list">
      <td align="center">关 键 字：</td>
      <td><input name="keywords" type="text" id="keywords" size="60"/></td>
    </tr>
    <tr class="list">
      <td align="center">单页简介：</td>
      <td><input name="description" type="text" id="description" size="60"/></td>
    </tr>
    <tr class="list">
      <td height="20" align="center">详细内容：</td>
      <td>
      <script charset="utf-8" src="/webedito/kindeditor-min.js"></script>
	  <script charset="utf-8" src="/webedito/lang/zh_CN.js"></script>
	  <script>
	  var editor;
	  KindEditor.ready(function(K) {
	  	  editor = K.create('textarea[id="content"]', {
	  	  	  allowFileManager : true,
			  filterMode : false,
			  afterBlur : function() {this.sync();}
	  	  });
	  });
	  </script>
	  <textarea name="content" id="content" style="width:100%;height:400px;visibility:hidden;display:none;"><?php
$value=htmlspecialchars(stripslashes($rsdb[content]));
echo $value?></textarea>
      </td>
    </tr>
    <tr class="list">
      <td align="center">单页排序：</td>
      <td>
	  <table cellpadding="0" cellspacing="0" border="0"><tr><td><input name="orderid" type="text" id="orderid" size="20" value="666"/></td><td>&nbsp;数字越小越靠前，默认为：666</td></tr></table></td>
    </tr>
    <tr class="list">
      <td height="30" colspan="2" align="center"><label>
        <input name="Submit" type="submit" class="button" value="提交" />
      </label></td>
    </tr>
</form>
  </table>
<div class="height10"></div>
</div>
<?PHP
}
elseif($actions=="modi"){
$sql="select * from mx_vpp_infor where id='$id' limit 1";
$result=$db->excu($sql);
$rst=$db->fetch_array($result);
if ($gotourl==""){$gotourl=url_encode($_SERVER['HTTP_REFERER']);}
?>
<div class="xm2">
<h1 class="fl">修改单页信息</h1>
</div>
<div class="xm2_b">
<div class="height10"></div>
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="table_southidc">
<form id="form22" name="form22" method="post" action="yx_vpp_danye.php?actions=saveedit" onSubmit="javascript:KindSubmit();return check();">
    <!--<tr class="list">
      <td width="14%" height="20" align="center">所属类别：</td>
      <td width="86%"><label>
        <select name="pid">
		<option value="0">顶级栏目</option>
		<?php
//		$rs=$db->excu("select * from mx_vpp_infor where pid='0'");
//		if ($db->num_rows($rs)>0 ){
//		    while($rsdb=$db->fetch_array($rs)){
		?>
		<option value="<?php //echo $rsdb["id"]?>" <?php //if ( $rsdb["id"]==$rst["pid"]) {echo "selected";}?>><?php //echo $rsdb["name"]?></option>
		<?php
//			}
//		}
		?>
		</select>
      </label></td>
    </tr>-->
    <tr class="list">
      <td width="14%" height="20" align="center">单页名称：</td>
      <td width="86%"><label>
        <input name="name" type="text" id="name" value="<?PHp echo $rst[name];?>" size="60" />
        <input name="id" type="hidden" id="id" value="<?PHP echo $rst[id];?>" />
      </label></td>
    </tr>
    <tr class="list">
      <td width="14%" height="20" align="center">关&nbsp;&nbsp;键&nbsp;&nbsp;字：</td>
      <td width="86%"><label>
        <input name="keywords" type="text" id="keywords" size="60" value="<?PHp echo $rst[keywords];?>"/>
      *</label></td>
    </tr>
    <tr class="list">
      <td width="14%" height="20" align="center">单页简介：</td>
      <td width="86%"><label>
        <input name="description" type="text" id="description" size="60" value="<?PHp echo $rst[description];?>"/>
      *</label></td>
    </tr>
    <tr class="list">
      <td height="20" align="center">详细内容：</td>
      <td>
	<script charset="utf-8" src="/webedito/kindeditor-min.js"></script>
	  <script charset="utf-8" src="/webedito/lang/zh_CN.js"></script>
	  <script>
	  var editor;
	  KindEditor.ready(function(K) {
	  	  editor = K.create('textarea[id="content"]', {
	  	  	  allowFileManager : true,
			  filterMode : false,
			  afterBlur : function() {this.sync();}
	  	  });
	  });
	  </script>
	  <textarea name="content" id="content" style="width:100%;height:400px;visibility:hidden;display:none;"><?php
$value=htmlspecialchars(stripslashes($rst[content]));
echo $value?></textarea></td>
    </tr>
    <tr class="list">
      <td width="14%" height="20" align="center">单页排序：</td>
      <td width="86%">
	  <table cellpadding="0" cellspacing="0" border="0"><tr><td><input name="orderid" type="text" id="orderid" value="<?php echo $rst["orderid"]?>"/></td><td>&nbsp;数字越小越靠前，默认为：666</td></tr></table></td>
    </tr>
    <tr class="list">
      <td height="30" colspan="2" align="center"><label>
        <input name="Submit" type="submit" class="button" value="提交" />
		<input type="hidden" name="gotourl" value="<?php echo $gotourl?>">
      </label></td>
    </tr>
</form>
  </table>
<div class="height10"></div>
</div>
<?PHP
}
else{
?>
<div class="xm2">
<h1 class="fl">单页列表</h1>
</div>
<div class="xm2_b" style="border-bottom:0px;">
<div class="t">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td>
	<div class="an1"><a href="yx_vpp_danye.php">所有单页</a></div>
	<div class="an2"><a href="yx_vpp_danye.php?actions=add">添加单页</a></div>
	</td>
	</tr>
	</table>
</div>
</div>
<div class="xm2_b">
<div class="height10"></div>
<table width="100%" border="0" align="center" cellpadding="8" cellspacing="1" class="table_southidc">
  <tr class="head">
    <th width="80%">标题</th>
    <th width="20%" align="center">管理操作</th>
  </tr>
  <?PHP
  if(empty($pageindex)){
      $pageindex=1;
  }
  $pagesize=20;

  $table=" mx_vpp_infor ";
  $order=" order by orderid asc, id asc";
  $column=" * ";
  $biaoid="id";
  $c=$db->listcount($table,$SQL);
  
  $list=$db->list1($pageindex,$pagesize,$table,$column,$SQL,$order,$biaoid);
  if (!is_array($list)){
  echo "<tr class=\"list1\"><td colspan=2><center>暂无信息</center></td></tr>";
  }
  else{
  for($i=0;$i<count($list);$i++){
  ?>
  <tr class="list">
    <td>&nbsp;<?PHp echo $list[$i][name];?></td>
    <td align="center">
    <!--<a href="yx_vpp_danye.php?actions=add&amp;id=<?Php echo $list[$i][id];?>" title="添加子栏目" >添加子栏目</a>&nbsp;&nbsp;-->
	<a href="yx_vpp_danye.php?actions=modi&id=<?Php echo $list[$i][id];?>" title="修改信息" >修改</a>
    &nbsp;&nbsp;<a href="yx_vpp_danye.php?actions=del&amp;id=<?PHP echo $list[$i][id];?>"  title="删除" onClick="return confirm('确定要删除此信息吗？')">删除</a>
	</td>
  </tr>
  <?PHP
  }
  ?>
  </table>
  
  <?php
    if ($c>$pagesize){
  ?>
			<div class="clear"></div>
			<div class="pagination">
			<?PHP
			echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize)
			?>
			</div>
			<div class="clear"></div>
			<div class="height10"></div>
  <?php
	}

  }
  ?>
<div class="clear"></div>
<div class="height10"></div>
<script type="text/javascript" src="/mxsoft/js/jquerys-1.5.1.js"></script>
<script language="javascript">
$(document).ready(function(){  
	$(".table_southidc tr").mouseover(function(){   
	$(this).addClass("list2");}).mouseout(function(){   
	$(this).removeClass("list2");}) //移除该行的class   
	$(".table_southidc tr:even").addClass("list1");   
});   
</script> 
<?php
}
?>
</div>
<?php require("../mx_foot.php");?>
<div class="clear"></div>
<div class="height10"></div>
<SCRIPT language=JavaScript type=text/javascript>
function check()
{
	if (!CheckLength("name","单页名称")){
		return false;
	}
}
</SCRIPT>

</body>
</html>
